<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <title>xrkmonitor - 登录</title>
	<link rel="icon" href="<?cs var:config.docpath?>images/zifu_48.ico">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
	<meta name="keywords" content="字符云监控系统,云监控系统,监控提醒,日志系统,云日志系统,日志汇聚,多云部署">
	<meta name="description" content="字符云监控系统-多云部署一站监控,一切尽在掌握!">
	<meta name="author" content="rockdeng,1820140912@qq.com,qq:1820140912">
	<meta name="renderer" content="webkit">

	<link href="<?cs var:config.docpath?>resource/font-awesome/css/font-awesome.min.css?v=66" rel="stylesheet"/>
	<link href="<?cs var:config.docpath?>resource/themes/css/login.css?v=20500507" rel="stylesheet" />
	<?cs if:config.xrkmonitor_debug==1 ?>
	<link href="<?cs var:config.docpath?>resource/layui/css/layui.css" rel="stylesheet" />
	<?cs else ?>
	<link href="<?cs var:config.docpath?>resource/layui/css/layui.min.css?v=20200506" rel="stylesheet" />
	<?cs /if ?>
	<link rel="stylesheet" type="text/css" href="<?cs var:config.docpath?>/login/css/wz_normalize.css" />
</head>

<body class="kit-login-bg" style='overflow:hidden'>
    <div>
        <div class="kit-login-box">
            <div class="kit-login-main" style='margin-bottom:20px'>
                <div class="layui-form" method="get">
                    <div class="layui-form-item">
                        <label class="kit-login-icon">
                            <i class="layui-icon">&#xe612;</i>
                        </label>
						<?cs if:config.free_uname ?>
                        <input type="text" id="username" lay-verify="userKey" autocomplete="off" value='<?cs var:config.free_uname ?>' class="layui-input">              
						<?cs else ?>
                        <input type="text" id="username" lay-verify="userKey" autocomplete="off" placeholder="输入用户名" class="layui-input">              
						<?cs /if ?>
                    </div>
                    <div class="layui-form-item">
                        <label class="kit-login-icon">
                            <i class="layui-icon">&#xe6b1;</i>
                        </label>
						<?cs if:config.free_upass ?>
                        <input type="password" id="password" lay-verify="password" autocomplete="off" value='<?cs var:config.free_upass ?>' class="layui-input">             
						<?cs else ?>
                        <input type="password" id="password" lay-verify="password" placeholder="输入密码" autocomplete="off" class="layui-input">             
						<?cs /if ?>
                    </div>
                    <div class="layui-form-item">
                        <div class="kit-pull-right">
                            <button id='btn_login' onClick='return login_submit();' class="layui-btn layui-btn-primary" lay-submit lay-filter="login">
                                <i class="fa fa-sign-in " aria-hidden="true"></i> 登 入
                            </button>                               
                            <button id='btn_clear' onClick='return clear_input();' class="layui-btn layui-btn-primary" lay-submit lay-filter="login">
                                <i class="fa fa-sign-in" aria-hidden="true"></i> 重 填 
                            </button>                               
                        </div>
                    </div>
                    <div class="layui-form-item" align='center' style='height:20px'>
						<font id="loginmsg" style='font-weight:bold;font-size:14px;'></font>
					</div>
                </div>
            </div>
        </div>
    </div>

<?cs if:config.isdaemon == 1 ?>
<script src="<?cs var:config.docpath?>js/dmt_xrkmonitor.js"></script>
<?cs /if ?>

<?cs if:config.xrkmonitor_debug==1 ?>
<script src="<?cs var:config.docpath?>resource/js/jquery.js?v=1"></script>
<script src="<?cs var:config.docpath?>resource/js/jquery.md5.js"></script>
<script src="<?cs var:config.docpath?>resource/js/jquery.cookie.js"></script>
<script src="<?cs var:config.docpath?>resource/js/dmt.comm.js" type="text/javascript"></script>
<?cs else ?>
<script src="<?cs var:config.docpath?>resource/js/jquery.min.js?v=2020506"></script>
<script src="<?cs var:config.docpath?>resource/js/jquery.other.min.js?v=2020506"></script>
<script src="<?cs var:config.docpath?>resource/js/dmt.comm.min.js?v=111120708" type="text/javascript"></script>
<script src="<?cs var:config.docpath?>resource/js/sideshow/sideshow.min.js?v=20200506"></script>
<?cs /if ?>

<script src='https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js'></script>
<script src="<?cs var:config.docpath?>login/js/wz_script.js?v=96"></script>

<script language="javascript" type="text/javascript">
	var g_req_timestamp = 0;
	var g_login_in_cust_server = 0;

	function goto_online()
	{
		window.open('http://xrkmonitor.com', '_blank');
	}

	function dltSetLoginPos() {
		var w = $(window).width();
		var h = $(window).height();
		if(w > 390) {
			var p=(w-390)/2;
			$(".kit-login-box").css("margin-left", ''+p+'px');
		}
		if(h > 300) {
			var p=(h-300)/3*2;
			$(".kit-login-box").css("margin-top", ''+p+'px');
		}
	}
	dltSetLoginPos();

	function login_submit()
	{
		if ($('#username').val() == ""){
			$('#loginmsg').html('<font color="#ff0000">请输入用户名</font>');
			$('#username').focus();
			return false;
		}
		if ($('#password').val() == ""){
			$('#loginmsg').html('<font color="#ff0000">请输入密码</font>');
			$('#password').focus();
			return false;
		}
		$('#btn_login').addClass('layui-btn-disabled');
		
		var requrl = "<?cs var:config.cgipath?>slog_flogin";
		var reqpara = {};
		reqpara.username = $('#username').val();
		var input_passwd = $('#password').val();
		var pass_md5 = $.md5(input_passwd);
		reqpara.password = pass_md5;
		reqpara.action = "check";
		reqpara.response_method = "json";
		reqpara.redirect_url = "<?cs var:config.redirect_url ?>";
		reqpara.login_type = 0;

		var d = new Date();
		g_req_timestamp = d.getTime();

		$('#loginmsg').html('<font">正在验证用户身份……</font>');
		$.ajax({
			url:requrl, 
			data:reqpara, 
			success:function(result){
				$('#btn_login').removeClass('layui-btn-disabled');
				switch (result.code) {
					case 0:
						document.location = result.redirect_url;
						break;
					case 8:
						if(g_login_in_cust_server != 0) {
							$('#loginmsg').html('<font color="#ff0000">系统错误，请稍后刷新网页重试。</font>');
						}
						else {
							window.location = result.cust_login_server;; 
						}
						break;
					default:
						$('#loginmsg').html('<font color="#ff0000">用户名或密码错误！</font>');
						$('#username').focus();
						break;
					}
				}, 
			error:function(q,errmsg,err){
					$('#btn_login').removeClass('layui-btn-disabled');
					var hm = '<font color="#ff0000">验证失败，服务器异常！';
					hm += "错误信息：" + errmsg;
					hm += '</font>'
					$('#loginmsg').html(hm);
				},
			dataType:'json'
		});	
		return false;
	}

	function clear_input()
	{
		$('#password').val("");
		$('#username').val("");
		$('#loginmsg').html("");
		$('#username').focus();
		return false;
	}

	$(document).ready(function(){
		<?cs if:config.isdaemon ?>
			<?cs if:config.free_uname ?>
			$('#btn_login').focus();
			<?cs else ?>
			$('#loginmsg').html('<font color="#ff0000">当前无可用演示账号, 请稍后再试 ...</font>');
			<?cs /if ?>
		<?cs else ?>
		$('#username').focus();
		<?cs /if ?>
	}).keydown(function(event){
		if(event.keyCode==13){
			login_submit();
			return false;
		}
	});
</script>

</body>
</html>

